package p270jp.pxv.android.view;

import android.content.Context;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.constraintlayout.widget.ConstraintLayout;
import java.util.Arrays;
import p045be.View$OnLongClickListenerC1075h1;
import p062c4.ViewBindings;
import p064c6.Preconditions;
import p134ei.AnalyticsScreenName;
import p134ei.PixivAnalytics;
import p144f1.C3017s;
import p165fo.C3114c;
import p184gi.AnalyticsParameter;
import p184gi.ClickEvent;
import p189gn.AbstractC3435a;
import p216hn.Lambda;
import p216hn.Reflection;
import p270jp.pxv.android.R;
import p270jp.pxv.android.activity.NovelSeriesDetailActivity;
import p270jp.pxv.android.legacy.analytics.firebase.model.ComponentVia;
import p270jp.pxv.android.legacy.event.ShowNovelDetailDialogEvent;
import p270jp.pxv.android.legacy.event.ShowNovelTextEvent;
import p270jp.pxv.android.legacy.model.PixivNovel;
import p270jp.pxv.android.view.NewNovelItemView;
import p314lg.ViewNewNovelItemBinding;
import p325m0.MutabilityOwnership;
import p374nm.BaseMuteLayout;
import p376no.Koin;
import p404oo.AbstractC5475a;
import p470ri.HashtagService;
import p579vo.Qualifier;
import p603wm.AbstractC6949c;
import p677zi.PixivImageLoader;

/* compiled from: NewNovelItemView.kt */
/* renamed from: jp.pxv.android.view.NewNovelItemView */
/* loaded from: classes2.dex */
public final class NewNovelItemView extends BaseMuteLayout implements AbstractC5475a {

    /* renamed from: h */
    public static final /* synthetic */ int f19572h;

    /* renamed from: b */
    public PixivNovel f19573b;

    /* renamed from: c */
    public boolean f19574c;

    /* renamed from: d */
    public ViewNewNovelItemBinding f19575d;

    /* renamed from: e */
    public final AbstractC6949c f19576e = Preconditions.m9802P(1, new C4378a(this, null, null));

    /* renamed from: f */
    public final AbstractC6949c f19577f = Preconditions.m9802P(1, new C4379b(this, null, null));

    /* renamed from: g */
    public final AbstractC6949c f19578g = Preconditions.m9802P(1, new C4380c(this, null, null));

    /* compiled from: KoinComponent.kt */
    /* renamed from: jp.pxv.android.view.NewNovelItemView$a */
    /* loaded from: classes2.dex */
    public static final class C4378a extends Lambda implements AbstractC3435a<HashtagService> {

        /* renamed from: a */
        public final /* synthetic */ AbstractC5475a f19579a;

        /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
        public C4378a(AbstractC5475a aVar, Qualifier aVar2, AbstractC3435a aVar3) {
            super(0);
            this.f19579a = aVar;
        }

        /* JADX WARN: Type inference failed for: r0v4, types: [java.lang.Object, ri.a] */
        @Override // p189gn.AbstractC3435a
        public final HashtagService invoke() {
            return this.f19579a.getKoin().f24118a.m920a().m621a(Reflection.m5499a(HashtagService.class), null, null);
        }
    }

    /* compiled from: KoinComponent.kt */
    /* renamed from: jp.pxv.android.view.NewNovelItemView$b */
    /* loaded from: classes2.dex */
    public static final class C4379b extends Lambda implements AbstractC3435a<PixivImageLoader> {

        /* renamed from: a */
        public final /* synthetic */ AbstractC5475a f19580a;

        /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
        public C4379b(AbstractC5475a aVar, Qualifier aVar2, AbstractC3435a aVar3) {
            super(0);
            this.f19580a = aVar;
        }

        /* JADX WARN: Type inference failed for: r0v4, types: [java.lang.Object, zi.a] */
        @Override // p189gn.AbstractC3435a
        public final PixivImageLoader invoke() {
            return this.f19580a.getKoin().f24118a.m920a().m621a(Reflection.m5499a(PixivImageLoader.class), null, null);
        }
    }

    /* compiled from: KoinComponent.kt */
    /* renamed from: jp.pxv.android.view.NewNovelItemView$c */
    /* loaded from: classes2.dex */
    public static final class C4380c extends Lambda implements AbstractC3435a<PixivAnalytics> {

        /* renamed from: a */
        public final /* synthetic */ AbstractC5475a f19581a;

        /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
        public C4380c(AbstractC5475a aVar, Qualifier aVar2, AbstractC3435a aVar3) {
            super(0);
            this.f19581a = aVar;
        }

        /* JADX WARN: Type inference failed for: r0v4, types: [ei.e, java.lang.Object] */
        @Override // p189gn.AbstractC3435a
        public final PixivAnalytics invoke() {
            return this.f19581a.getKoin().f24118a.m920a().m621a(Reflection.m5499a(PixivAnalytics.class), null, null);
        }
    }

    /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
    public NewNovelItemView(Context context, AttributeSet attributeSet) {
        super(context, attributeSet);
        MutabilityOwnership.m3745m(context, "context");
    }

    /* renamed from: c */
    public static void m4484c(NewNovelItemView newNovelItemView, ClickEvent dVar, PixivNovel pixivNovel, ComponentVia componentVia, AnalyticsScreenName cVar, Long l, View view) {
        MutabilityOwnership.m3745m(newNovelItemView, "this$0");
        MutabilityOwnership.m3745m(dVar, "$viewMoreClickEvent");
        MutabilityOwnership.m3745m(pixivNovel, "$novel");
        newNovelItemView.getPixivAnalytics().m6526d(dVar);
        C3114c.m6284b().m6280f(new ShowNovelDetailDialogEvent(pixivNovel, componentVia, cVar, l));
    }

    /* renamed from: d */
    public static void m4483d(ClickEvent dVar, NewNovelItemView newNovelItemView, PixivNovel pixivNovel, View view) {
        MutabilityOwnership.m3745m(newNovelItemView, "this$0");
        MutabilityOwnership.m3745m(pixivNovel, "$novel");
        if (dVar != null) {
            newNovelItemView.getPixivAnalytics().m6526d(dVar);
        }
        NovelSeriesDetailActivity.C4031a aVar = NovelSeriesDetailActivity.f18438g0;
        Context context = newNovelItemView.getContext();
        MutabilityOwnership.m3746l(context, "context");
        newNovelItemView.getContext().startActivity(aVar.m4800a(context, pixivNovel.series.f19077id, pixivNovel.user.f19078id));
    }

    /* renamed from: e */
    public static void m4482e(NewNovelItemView newNovelItemView, ClickEvent dVar, PixivNovel pixivNovel, ComponentVia componentVia, AnalyticsScreenName cVar, View view) {
        MutabilityOwnership.m3745m(newNovelItemView, "this$0");
        MutabilityOwnership.m3745m(dVar, "$clickEvent");
        MutabilityOwnership.m3745m(pixivNovel, "$novel");
        newNovelItemView.getPixivAnalytics().m6526d(dVar);
        C3114c.m6284b().m6280f(new ShowNovelTextEvent(pixivNovel, componentVia, cVar));
    }

    private final HashtagService getHashtagService() {
        return (HashtagService) this.f19576e.getValue();
    }

    private final PixivAnalytics getPixivAnalytics() {
        return (PixivAnalytics) this.f19578g.getValue();
    }

    private final PixivImageLoader getPixivImageLoader() {
        return (PixivImageLoader) this.f19577f.getValue();
    }

    @Override // p374nm.BaseMuteLayout
    /* renamed from: a */
    public View mo3337a() {
        View inflate = LayoutInflater.from(getContext()).inflate(R.layout.view_new_novel_item, (ViewGroup) this, false);
        int i = R.id.author_text_view;
        TextView textView = (TextView) ViewBindings.m9835b(inflate, R.id.author_text_view);
        if (textView != null) {
            i = R.id.cover_image_view;
            ImageView imageView = (ImageView) ViewBindings.m9835b(inflate, R.id.cover_image_view);
            if (imageView != null) {
                i = R.id.like_button;
                LikeButton likeButton = (LikeButton) ViewBindings.m9835b(inflate, R.id.like_button);
                if (likeButton != null) {
                    i = R.id.like_count_text_view;
                    TextView textView2 = (TextView) ViewBindings.m9835b(inflate, R.id.like_count_text_view);
                    if (textView2 != null) {
                        ConstraintLayout constraintLayout = (ConstraintLayout) inflate;
                        i = R.id.read_more_tap_area;
                        View b = ViewBindings.m9835b(inflate, R.id.read_more_tap_area);
                        if (b != null) {
                            i = R.id.read_more_text_view;
                            TextView textView3 = (TextView) ViewBindings.m9835b(inflate, R.id.read_more_text_view);
                            if (textView3 != null) {
                                i = R.id.series_text_view;
                                TextView textView4 = (TextView) ViewBindings.m9835b(inflate, R.id.series_text_view);
                                if (textView4 != null) {
                                    i = R.id.tag_text_view;
                                    TextView textView5 = (TextView) ViewBindings.m9835b(inflate, R.id.tag_text_view);
                                    if (textView5 != null) {
                                        i = R.id.title_text_view;
                                        TextView textView6 = (TextView) ViewBindings.m9835b(inflate, R.id.title_text_view);
                                        if (textView6 != null) {
                                            setBinding(new ViewNewNovelItemBinding(constraintLayout, textView, imageView, likeButton, textView2, constraintLayout, b, textView3, textView4, textView5, textView6));
                                            ConstraintLayout constraintLayout2 = getBinding().f21521a;
                                            MutabilityOwnership.m3746l(constraintLayout2, "binding.getRoot()");
                                            return constraintLayout2;
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
        throw new NullPointerException("Missing required view with ID: ".concat(inflate.getResources().getResourceName(i)));
    }

    /* renamed from: f */
    public final void m4481f(PixivNovel pixivNovel, ComponentVia componentVia, AnalyticsScreenName cVar, Long l, ClickEvent dVar, ClickEvent dVar2, ClickEvent dVar3) {
        if (C3017s.m6470f(pixivNovel, this.f19574c)) {
            setMuteCoverVisibility(0);
            return;
        }
        this.f19573b = pixivNovel;
        setMuteCoverVisibility(8);
        PixivImageLoader pixivImageLoader = getPixivImageLoader();
        Context context = getContext();
        MutabilityOwnership.m3746l(context, "context");
        String medium = pixivNovel.imageUrls.getMedium();
        ImageView imageView = getBinding().f21523c;
        MutabilityOwnership.m3746l(imageView, "binding.coverImageView");
        pixivImageLoader.m59g(context, medium, imageView);
        getBinding().f21525e.setText(String.valueOf(pixivNovel.totalBookmarks));
        getBinding().f21529i.setText(pixivNovel.title);
        TextView textView = getBinding().f21522b;
        String format = String.format("by %s", Arrays.copyOf(new Object[]{pixivNovel.user.name}, 1));
        MutabilityOwnership.m3746l(format, "java.lang.String.format(format, *args)");
        textView.setText(format);
        String c = getHashtagService().m2578c(pixivNovel);
        String string = getResources().getString(R.string.novel_words_format, Integer.valueOf(pixivNovel.textLength));
        MutabilityOwnership.m3746l(string, "resources.getString(jp.p…format, novel.textLength)");
        TextView textView2 = getBinding().f21528h;
        String format2 = String.format("%s%s%s", Arrays.copyOf(new Object[]{string, "  ", c}, 3));
        MutabilityOwnership.m3746l(format2, "java.lang.String.format(format, *args)");
        textView2.setText(format2);
        if (pixivNovel.series.f19077id > 0) {
            getBinding().f21527g.setVisibility(0);
            getBinding().f21527g.setText(pixivNovel.series.title);
        } else {
            getBinding().f21527g.setVisibility(8);
        }
        getBinding().f21524d.setWork(pixivNovel);
        getBinding().f21527g.setOnClickListener(new View.OnClickListener(this, pixivNovel) { // from class: nm.f0

            /* renamed from: b */
            public final /* synthetic */ NewNovelItemView f24035b;

            /* renamed from: c */
            public final /* synthetic */ PixivNovel f24036c;

            {
                this.f24035b = r2;
                this.f24036c = r3;
            }

            @Override // android.view.View.OnClickListener
            public final void onClick(View view) {
                NewNovelItemView.m4483d(ClickEvent.this, this.f24035b, this.f24036c, view);
            }
        });
        setOnClickListener(new View.OnClickListener(dVar, pixivNovel, componentVia, cVar) { // from class: nm.g0

            /* renamed from: b */
            public final /* synthetic */ ClickEvent f24040b;

            /* renamed from: c */
            public final /* synthetic */ PixivNovel f24041c;

            /* renamed from: d */
            public final /* synthetic */ ComponentVia f24042d;

            /* renamed from: e */
            public final /* synthetic */ AnalyticsScreenName f24043e;

            {
                this.f24040b = r2;
                this.f24041c = r3;
                this.f24042d = r4;
                this.f24043e = r5;
            }

            @Override // android.view.View.OnClickListener
            public final void onClick(View view) {
                NewNovelItemView.m4482e(NewNovelItemView.this, this.f24040b, this.f24041c, this.f24042d, this.f24043e, view);
            }
        });
        setOnLongClickListener(new View$OnLongClickListenerC1075h1(pixivNovel, 1));
        getBinding().f21526f.setOnClickListener(new View.OnClickListener(dVar2, pixivNovel, componentVia, cVar, l) { // from class: nm.h0

            /* renamed from: b */
            public final /* synthetic */ ClickEvent f24047b;

            /* renamed from: c */
            public final /* synthetic */ PixivNovel f24048c;

            /* renamed from: d */
            public final /* synthetic */ ComponentVia f24049d;

            /* renamed from: e */
            public final /* synthetic */ AnalyticsScreenName f24050e;

            /* renamed from: f */
            public final /* synthetic */ Long f24051f;

            {
                this.f24047b = r2;
                this.f24048c = r3;
                this.f24049d = r4;
                this.f24050e = r5;
                this.f24051f = r6;
            }

            @Override // android.view.View.OnClickListener
            public final void onClick(View view) {
                NewNovelItemView.m4484c(NewNovelItemView.this, this.f24047b, this.f24048c, this.f24049d, this.f24050e, this.f24051f, view);
            }
        });
    }

    public final ViewNewNovelItemBinding getBinding() {
        ViewNewNovelItemBinding eaVar = this.f19575d;
        if (eaVar != null) {
            return eaVar;
        }
        MutabilityOwnership.m3737u("binding");
        throw null;
    }

    @Override // p404oo.AbstractC5475a
    public Koin getKoin() {
        return AbstractC5475a.C5476a.m3211a(this);
    }

    public final PixivNovel getNovel() {
        return this.f19573b;
    }

    public final void setAnalyticsParameter(AnalyticsParameter cVar) {
        MutabilityOwnership.m3745m(cVar, "analyticsParameter");
        getBinding().f21524d.setAnalyticsParameter(cVar);
    }

    public final void setBinding(ViewNewNovelItemBinding eaVar) {
        MutabilityOwnership.m3745m(eaVar, "<set-?>");
        this.f19575d = eaVar;
    }

    public final void setIgnoreMuted(boolean z) {
        this.f19574c = z;
    }
}
